package com.zhongfl.crm.lixiao.batch.jobs;

import tech.heptagram.core.common.batch.BatchService;

public abstract class JobService implements BatchService {

    public static final int DEFAULT_UPDATE_COUNT = 1;

    /**
     * 锁定任务
     */
    public abstract boolean lock();

    /**
     * 任务开始点
     */
    public abstract void start() throws Exception;

    @Override
    public void run() throws RuntimeException {
        if (lock()) {
            try {
                start();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
